<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>org.apache.commons.math3.ode.events (Apache Commons Math 3.6.1 API)</title>
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
    if (location.href.indexOf('is-external=true') == -1) {
        parent.document.title="org.apache.commons.math3.ode.events (Apache Commons Math 3.6.1 API)";
    }
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!--   -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/ode/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../../org/apache/commons/math3/ode/nonstiff/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/ode/events/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_top");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip-navbar_top">
<!--   -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<div class="header">
<h1 title="Package" class="title">Package&nbsp;org.apache.commons.math3.ode.events</h1>
<div class="docSummary">
<div class="block">
 This package provides classes to handle discrete events occurring during
 Ordinary Differential Equations integration.</div>
</div>
<p>See:&nbsp;<a href="#package_description">Description</a></p>
</div>
<div class="contentContainer">
<ul class="blockList">
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Interface Summary table, listing interfaces, and an explanation">
<caption><span>Interface Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Interface</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events">EventHandler</a></td>
<td class="colLast">
<div class="block">This interface represents a handler for discrete events triggered
 during ODE integration.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/FieldEventHandler.html" title="interface in org.apache.commons.math3.ode.events">FieldEventHandler</a>&lt;T extends <a href="../../../../../../org/apache/commons/math3/RealFieldElement.html" title="interface in org.apache.commons.math3">RealFieldElement</a>&lt;T&gt;&gt;</td>
<td class="colLast">
<div class="block">This interface represents a handler for discrete events triggered
 during ODE integration.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Class Summary table, listing classes, and an explanation">
<caption><span>Class Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Class</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html" title="class in org.apache.commons.math3.ode.events">EventFilter</a></td>
<td class="colLast">
<div class="block">Wrapper used to detect only increasing or decreasing events.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/EventState.html" title="class in org.apache.commons.math3.ode.events">EventState</a></td>
<td class="colLast">
<div class="block">This class handles the state for one <a href="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><code>event handler</code></a> during integration steps.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/FieldEventState.html" title="class in org.apache.commons.math3.ode.events">FieldEventState</a>&lt;T extends <a href="../../../../../../org/apache/commons/math3/RealFieldElement.html" title="interface in org.apache.commons.math3">RealFieldElement</a>&lt;T&gt;&gt;</td>
<td class="colLast">
<div class="block">This class handles the state for one <a href="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html" title="interface in org.apache.commons.math3.ode.events"><code>event handler</code></a> during integration steps.</div>
</td>
</tr>
</tbody>
</table>
</li>
<li class="blockList">
<table class="packageSummary" border="0" cellpadding="3" cellspacing="0" summary="Enum Summary table, listing enums, and an explanation">
<caption><span>Enum Summary</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Enum</th>
<th class="colLast" scope="col">Description</th>
</tr>
<tbody>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/Action.html" title="enum in org.apache.commons.math3.ode.events">Action</a></td>
<td class="colLast">
<div class="block">Enumerate for actions to be performed when an event occurs during ODE integration.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/EventHandler.Action.html" title="enum in org.apache.commons.math3.ode.events">EventHandler.Action</a></td>
<td class="colLast">
<div class="block">Enumerate for actions to be performed when an event occurs.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><a href="../../../../../../org/apache/commons/math3/ode/events/FilterType.html" title="enum in org.apache.commons.math3.ode.events">FilterType</a></td>
<td class="colLast">
<div class="block">Enumerate for <a href="../../../../../../org/apache/commons/math3/ode/events/EventFilter.html" title="class in org.apache.commons.math3.ode.events"><code>filtering events</code></a>.</div>
</td>
</tr>
</tbody>
</table>
</li>
</ul>
<a name="package_description">
<!--   -->
</a>
<h2 title="Package org.apache.commons.math3.ode.events Description">Package org.apache.commons.math3.ode.events Description</h2>
<div class="block"><p>
 This package provides classes to handle discrete events occurring during
 Ordinary Differential Equations integration.
 </p>

 <p>
 Discrete events detection is based on switching functions. The user provides
 a simple <a href="../../../../../../org/apache/commons/math3/ode/events/EventHandler.html#g(double,%20double[])"><code>g(t, y)</code></a>
 function depending on the current time and state. The integrator will monitor
 the value of the function throughout integration range and will trigger the
 event when its sign changes. The magnitude of the value is almost irrelevant,
 it should however be continuous (but not necessarily smooth) for the sake of
 root finding. The steps are shortened as needed to ensure the events occur
 at step boundaries (even if the integrator is a fixed-step integrator).
 </p>

 <p>
 When an event is triggered, several different options are available:
 </p>
 <ul>
  <li>integration can be stopped (this is called a G-stop facility),</li>
  <li>the state vector or the derivatives can be changed,</li>
  <li>or integration can simply go on.</li>
 </ul>

 <p>
 The first case, G-stop, is the most common one. A typical use case is when an
 ODE must be solved up to some target state is reached, with a known value of
 the state but an unknown occurrence time. As an example, if we want to monitor
 a chemical reaction up to some predefined concentration for the first substance,
 we can use the following switching function setting:
 <pre>
  public double g(double t, double[] y) {
    return y[0] - targetConcentration;
  }

  public int eventOccurred(double t, double[] y) {
    return STOP;
  }
 </pre>
 </p>

 <p>
 The second case, change state vector or derivatives is encountered when dealing
 with discontinuous dynamical models. A typical case would be the motion of a
 spacecraft when thrusters are fired for orbital maneuvers. The acceleration is
 smooth as long as no maneuver are performed, depending only on gravity, drag,
 third body attraction, radiation pressure. Firing a thruster introduces a
 discontinuity that must be handled appropriately by the integrator. In such a case,
 we would use a switching function setting similar to this:
 <pre>
  public double g(double t, double[] y) {
    return (t - tManeuverStart) &lowast; (t - tManeuverStop);
  }

  public int eventOccurred(double t, double[] y) {
    return RESET_DERIVATIVES;
  }
 </pre>
 </p>

 <p>
 The third case is useful mainly for monitoring purposes, a simple example is:
 <pre>
  public double g(double t, double[] y) {
    return y[0] - y[1];
  }

  public int eventOccurred(double t, double[] y) {
    logger.log("y0(t) and y1(t) curves cross at t = " + t);
    return CONTINUE;
  }
 </pre>
 </p></div>
</div>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!--   -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!--   -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../overview-summary.html">Overview</a></li>
<li class="navBarCell1Rev">Package</li>
<li>Class</li>
<li><a href="package-use.html">Use</a></li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../../../../index-all.html">Index</a></li>
<li><a href="../../../../../../help-doc.html">Help</a></li>
</ul>
<div class="aboutLanguage"><em><script type="text/javascript" src="http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script></em></div>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../../../../org/apache/commons/math3/ode/package-summary.html">Prev Package</a></li>
<li><a href="../../../../../../org/apache/commons/math3/ode/nonstiff/package-summary.html">Next Package</a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/commons/math3/ode/events/package-summary.html" target="_top">Frames</a></li>
<li><a href="package-summary.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
  allClassesLink = document.getElementById("allclasses_navbar_bottom");
  if(window==top) {
    allClassesLink.style.display = "block";
  }
  else {
    allClassesLink.style.display = "none";
  }
  //-->
</script>
</div>
<a name="skip-navbar_bottom">
<!--   -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2003&#x2013;2016 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>
